package com.zmht.beike.biz.impl;

import java.io.Serializable;
import java.util.List;

import com.zmht.beike.biz.CaiminfoBiz;
import com.zmht.beike.core.BaseBizImpl;
import com.zmht.beike.model.PageModel;
import com.zmht.beike.po.TCaiminfo;

public class CaiminfoBizImpl extends BaseBizImpl implements CaiminfoBiz {

	public Integer save(TCaiminfo info) {
		try{
			return (Integer)this.getCaiminfoDAO().saveObj(info);
		}catch(Exception e){
			return 0;
		}
	}
	/**
	 * 获得领域目标信息
	 */
	public List getCaiminfo(int startIndex, int size, String teacherId) {
		return this.getCaiminfoDAO().findByPage("from TCaiminfo t where t.teacherId="+teacherId, startIndex, size);
		//return this.getCaiminfoDAO().findByHQLObj("from TCaiminfo t where t.teacherId="+teacherId);
	}
	/**
	 * 获得记录总数
	 */
	public int getCaiminfoTotal(int startIndex, int size, String teacherId) {
		return this.getCaiminfoDAO().findByHQLObj("from TCaiminfo t where t.teacherId="+teacherId).size();
	}
	public TCaiminfo findById(Serializable id) {
		
		return (TCaiminfo)this.getCaiminfoDAO().findById(TCaiminfo.class, id);
		
	}
	public boolean updateCaiminfo(TCaiminfo info) {
		try{
			return this.getCaiminfoDAO().updateObj(info);
		}catch(Exception e){
			return false;
		}
		
	}
	public List findBySQL(String sql,int startIndex,int pageSize) {
		
		return this.getCaiminfoDAO().findBySql(sql, startIndex, pageSize);//.findBySql(sql);
	}
	public int findBySQLTotal(String sql) {
		
		return this.getCaiminfoDAO().findAmountBySql(sql);
	}

	

}
